<template>
  <div></div>
</template>

<script>
  import isEmpty from 'lodash/isEmpty'
  import { defineComponent } from 'vue'
  // import { useRoute, useRouter } from 'vue-router'
  export default defineComponent({
    name: 'To',
    created() {
      console.log('to', this.$route.query.tk)
      if (isEmpty(this.$route.query.tk)) {
        this.$router.push('/')
      } else {
        this.$store.dispatch('user/setToken', this.$route.query.tk)
        this.$store.dispatch('user/setAppId', this.$route.query['appid'])
        this.$store.dispatch('user/setAppCode', this.$route.query['appCode'])
        this.$store.dispatch('user/setFirstWareHoseId', this.$route.query['wareHoseId'])
        this.$store.dispatch('user/setOrgCode', this.$route.query['orgId'])
        this.$store.dispatch('user/setLanguage', 'zh_CN')
        this.$router.push({
          path: '/menu',
          query: { webTk: true },
        })
      }
    },
    // setup() {
    //   const route = useRoute()
    //   const router = useRouter()
    //   console.log('Nico查找tk', isEmpty(route.query.tk))
    //   if (isEmpty(route.query.tk)) {
    //     router.push('/')
    //   } else {
    //     // userStore.setToken(route.query.tk)
    //     $store.dispatch('user/setToken', route.query.tk)
    //     router.push({
    //       path: '/menu',
    //       query: { webTk: true },
    //     })
    //   }
    // return {}
    // },
  })
</script>

<style lang="scss"></style>
